<?php

/**
 * acteur form base class.
 *
 * @method acteur getObject() Returns the current form's model object
 *
 * @package    e-DSL
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseacteurForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'             => new sfWidgetFormInputHidden(),
      'role_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('role'), 'add_empty' => false)),
      'description'    => new sfWidgetFormInputText(),
      'email'          => new sfWidgetFormInputText(),
      'region_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('region'), 'add_empty' => true)),
      'departement_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('departements'), 'add_empty' => true)),
      'personnes_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('personnes'), 'add_empty' => true)),
      'notifIntegrant' => new sfWidgetFormInputCheckbox(),
      'activeStatus'   => new sfWidgetFormInputText(),
      'created_at'     => new sfWidgetFormDateTime(),
      'updated_at'     => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'             => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'role_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('role'))),
      'description'    => new sfValidatorString(array('max_length' => 100)),
      'email'          => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'region_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('region'), 'required' => false)),
      'departement_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('departements'), 'required' => false)),
      'personnes_id'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('personnes'), 'required' => false)),
      'notifIntegrant' => new sfValidatorBoolean(array('required' => false)),
      'activeStatus'   => new sfValidatorInteger(),
      'created_at'     => new sfValidatorDateTime(),
      'updated_at'     => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('acteur[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'acteur';
  }

}
